For all examples, your project needs to have references to these assemblies:
Additionally, your code file should have the appropriate using/imports statements, which are not included in the samples:
Most examples do not include exception handling code; be sure to add that to your own code.